package CB_C19;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.stage.Alert.*;
import javafx.scene.shape.Line;
import javafx.scene.paint.Color;
import javafx.scene.control.Label;

/** Video Sector for Layout*/
public var video            :HBox;
/** brightness Sector for Layout*/
public var brightness       :HBox;
/**Strength Sector for Layout*/
public var strength         :HBox;
/** Play_Button and Timeline Sector for Layout*/
var play_timeline           :HBox;
/** Effect Sector for Layout*/
var effect                  :HBox;
/**Open_Save Sector for Layout*/
var open_save               :HBox;
/**Info Sectorfor Layout */
var info                    :HBox;

// instance of player:_old
//public var class_player         :Player         = new Player;
/** instance of Effect*/
public var class_effect         :gui_Effect         = new gui_Effect;
/** instance of Strenght*/
public var class_strength       :gui_Strength       = new gui_Strength;
/** instance of Strenght*/
public var class_brightness     :gui_Brightness     = new gui_Brightness;
/** instance of Info*/
public var class_info           :gui_Info           = new gui_Info;
/** instance of Strenght*/
public var class_play_timeline  :gui_Play_Timeline  = new gui_Play_Timeline;
/** instance of Open_Save*/
public var class_open_save      :gui_Open_Save      = new gui_Open_Save;
/** instance of Properties */
var class_properties            :Effect_Properties     = new Effect_Properties;
/** Title of the Applikation
* @defaultvalue CB-Media Player
*/
public var title : String = "CB-Media Player";
/** Stage witdh
* @defaultvalue 600
*/
public var stage_width : Integer = 600;
/** Stage height
* @defaultvalue 700
*/
public var stage_height : Integer = 700;
/** video_BOX height
* @defaultvalue 450
*/
public var video_height : Integer = 450;
/** Stage */
public var our_stage : Stage;

/** Swing Component*/
public var SMV: SwingMediaView;
public var p : MyProcessor;
public var comp: java.awt.Component;
/**Main Created on 10.11.2009. <br>
 * <br>
 * Defines the layout for our player<br>
 * @author Sebastian Czekierski, Stefan Blumberger
 */
public class Main
{

}
override public function run()
{
     our_stage = Stage
     {
          title: bind title;
          width:  bind stage_width;
          height: bind stage_height;
          resizable: false;
          opacity: 1;
          scene: Scene
          {
              content:
              [
                    video = HBox
                    {
                        translateX: 0;
                        translateY: 0;
                        height:   bind video_height;
                        width:    bind stage_width;
                        content:
                        [
                            SMV = SwingMediaView
                            {
                                player: bind comp;
                            }
                        ]
                    }
                    Label
                    {
                            text: "       Please choose Brightness or Strenght Effect and insert Media then choose Save or Play";
                            visible: bind not(Main.class_brightness.checkBox.disable);
                    }
                    Line
                    {
                                startX: 0;
                                endX: stage_width;
                                startY: video.height;
                                endY: video.height;
                                strokeWidth: 1;
                                stroke: Color.DARKGRAY;
                    }
                    play_timeline = HBox
                    {
                                translateX: 10;
                                translateY: bind video.height+5;
                                height: 40;
                                width: bind stage_width;
                                content: bind class_play_timeline.create();
                    }
                    Line
                    {
                                startX: 0;
                                endX: stage_width;
                                startY: video.height+play_timeline.height;
                                endY: video.height+play_timeline.height;
                                strokeWidth: 1;
                                stroke: Color.DARKGRAY;
                    }
                    effect = HBox
                    {
                        translateX: 10;
                        translateY: bind play_timeline.translateY + play_timeline.height +10;
                        height: 30;
                        width: bind stage_width;
                        content: bind class_effect.create();
                    }
                    strength = HBox
                    {
                        disable: bind not(class_effect.enable_effect.selected);
                        translateX: 10;
                        translateY: bind effect.translateY + effect.height+5;
                        height: 30;
                        width: bind stage_width;
                        content: bind class_strength.create();
                        visible: bind not(class_brightness.checkBox.selected);
                    }
                    brightness = HBox
                    {
                        disable: bind not(class_effect.enable_effect.selected);
                        translateX: 10;
                        translateY: bind strength.translateY +strength.height;
                        height: 20;
                        width: bind stage_width;
                        content: bind class_brightness.create()
                        visible: bind class_effect.enable_effect.visible;
                    }                    
                    HBox
                    {
                        translateY: bind brightness.translateY + brightness.height;
                        content:Line
                        {
                            startX: 0;
                            endX: stage_width;
                            startY:0;
                            endY: 0;
                            strokeWidth: 1;
                            stroke: Color.DARKGRAY;
                        }
                    }
                    open_save = HBox
                    {
                        translateX: 10;
                        translateY: bind brightness.translateY + brightness.height+10;
                        height: 30;
                        width: bind stage_width;
                        content: bind class_open_save.create();
                    }
                    info = HBox
                    {
                        translateX: 10;
                        translateY: bind open_save.translateY +open_save.height;
                        height: 30;
                        width: bind stage_width;
                        content: bind class_info.create();
                    }
               ]   
          }
          onClose: function()
          {
                Main.p.playerstop();
                class_properties.store_properties();
          }
     }
     class_properties.get_properties();
}